/*
 * @Author: liuzelin
 * @Date: 2023-09-09 11:51:45
 * @LastEditors: liuzelin
 * @LastEditTime: 2024-04-23 20:55:58
 * @Description: file content
 */
#pragma once
#include <stdint.h>

namespace Panda {

#pragma pack(push, 1)
enum FrameType : uint8_t {
  Data,
  ReTransData,
  Sack,
  KeepAlive,
  KeepAliveAck,
  ShakeHands,
  ShakeHandsAck,
  DisConnect,
  DisConnectAck,
};

struct Header {
  uint8_t ver : 4;
  uint8_t pos : 2;
  uint8_t ext : 1;
  uint8_t padding : 1;
  uint8_t type;
  uint8_t seq[2];
  uint8_t sid[4];
  uint8_t g_seq[4];
  uint8_t ts[4];
};

struct Frame {
  union {
    struct Header header;
    uint8_t header_data[sizeof(struct Header)];
  };
  uint8_t data[1500];
  uint16_t len = 0;
  uint16_t payload_len = 0;
};

#pragma pack(pop)

}  // namespace Panda